<template>
	<view>
		 <u-subsection :list="list" :current="curNow" @change="sectionChange" ></u-subsection>
		  <button type="warn" style="position: fixed;bottom: 0px;right: 50%;transform: translateX(50%);border-radius: 100%;width: 46px;" @click="topublish">+</button>
		 <news ref="news" :col="curNow"></news>
	</view>
	
</template>

<script>
	import news from "../../components/news.vue"
	export default {
		components:{
			news
		},
		data() {
			return {
				list: ['物业', '新闻', '动态'],
				curNow: 0
			}
		},
		onPullDownRefresh() {
			if(this.curNow==2){
				this.$refs.news.getActions();
			}
		},
		methods: {
			sectionChange(index) {
				this.curNow = index;
				//调用子方法
				console.log(index);
				if(index==1){
					this.$refs.news.getNews(index);
				}else if(index==2){
					this.$refs.news.getActions(index);
				}
			},
			topublish(){
				uni.navigateTo({
					url:"publish"
				})
			}
		}
	}
</script>
<style>

</style>

